<?php

namespace App\Http\Controllers\Api\Hotel;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Facades\Services\WelfareService;

class WelfareController extends Controller
{
    public function getWelfare(Request $request){

    	$rules = [
    		'id' => 'required'
    	];

    	$this->validate($request,$rules);

    	return formatJsonResponse(WelfareService::getWelfare($request->all()));
    }

    public function getWelfares(Request $request){

    	return formatJsonResponse(WelfareService::getWelfares($request->all()));
    }

    public function createWelfare(Request $request){

    	$rules = [
    		'title' => 'required',
    		'docs' => 'required'
    	];

    	$this->validate($request,$rules);

    	WelfareService::createWelfare($request->all());

    	return formatJsonResponse();
    }

    public function deleteWelfare(Request $request){
    	$rules = [
    		'id' => 'required'
    	];

    	$this->validate($request,$rules);

    	WelfareService::deleteWelfare($request->all());

    	return formatJsonResponse();
    }

    public function updateWelfare(Request $request){

    	$rules = [
    		'id' => 'required',
    		'title' => 'required',
    		'docs' => 'required'
    	];

    	$this->validate($request,$rules);

    	WelfareService::updateWelfare($request->all());

    	return formatJsonResponse();
    }
}
